<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
		<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
		<title>选择学生的小组</title>
		<link rel="stylesheet" type="text/css" href="../css/api.css"/>
		<style>
			body {
				background-color: #D8D8D8;
				margin: 0px;
			}
            .cell{
                text-align: center;
                font-size: 14px;
                height: 40px;
                line-height: 40px;
                vertical-align: center;
                width: auto;
                border: 1px solid #f2f2f2;
                background-color: white;
            }
            .bottomCancle{

            }
		</style>
	</head>
	<body >
		<div id="list_type" style="background-color: white;">
		</div>
		<div id="bottomCancle" class="bottomCancle" style="background-color: #BBBBBB;width: 100%;height: 100px;" onclick="closeFrame()">
		</div>
	</body>
	<script type="text/javascript" src="../../script/api.js"></script>
	<script src="../../script/jquery.min.js" type="text/javascript"></script>
	<script type="text/javascript">
        var array = [];
        var dataSource = [];
        var selet = "";
        var str = "";
        var init = 0;
		apiready = function() {
            // alert(api.pageParam.sections);
            // alert(JSON.stringify(api.pageParam.sections.length));
            if (array.length == 0)  {
                array = [];
                array = api.pageParam.sections;
                if (array.length == api.pageParam.sections.length) {
                    str = "";
                    if (init == 0) {
                        createData(array);
                    }
                }
            }
            if (dataSource.length == 0) {
            	dataSource = api.pageParam.data;
            }
		};
		function createData(data){
            // alert("创建数据时的array"+array.length);
            init = 1;
			str = "";
			str = '<div class="cell" onclick="clickDown(100)">全部分组</div>';
			for (var i = 0; i < data.length; i++) {
				var bg = "";
				// if (selet == dataSource[i].title) {
    //                 bg = "background-color: #F0F0F0;";
				// }
				str += '<div id= ('+i+') class="cell" '+bg+' onclick="clickDown('+i+')">'+
    				data[i]+
    			'</div>';
			}
			// alert(JSON.stringify(str));
			$('#list_type').html(str);
			var height = $('#list_type').height();
			$('#bottomCancle').height(api.winHeight-44-22-40-10-height);
		}
        function clickDown(index){
            // selet = dataSource[index].title;
            api.sendEvent({
                name: 'closeSelectTeamFrameNotification',
            });
            str = "";
            array = [];
            api.sendEvent({
                name: 'selectTeamStuNotification',
                extra: {
                    value : array[index],
                    index : index
                }
            });
        }
        function closeFrame(){
        	api.closeFrame({
                name: 'selectTeamStu'
            });
            api.sendEvent({
                name: 'closeSelectTeamFrameNotification',
            });
            str = "";
            array = [];
            $('#list_type').html("");
            SendBehaviorTrajectoriesNotifi(1, '学生选择小组人员', '047');
        }
	</script>
</html>